package com.neusiri.util;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;

/**
 * StringUtils
 * 发送短信工具类
 *
 * @author 丛有志
 * @date 2020/11/11 19:52
 * <p>
 * 版本        修改时间        作者        修改内容
 * V1.0        2020/11/11     丛有志        初始版本
 */
public class StringUtils {
    public static void main(String[] args) {
        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "LTAI4G6HNdsU5Tj3VGMPNCQu", "4icNX35D3k5nHQjZcSyMVErJp2w7Fg");
        IAcsClient client = new DefaultAcsClient(profile);

        CommonRequest request = new CommonRequest();
        request.setSysMethod(MethodType.POST);
        request.setSysDomain("dysmsapi.aliyuncs.com");
        request.setSysVersion("2017-05-25");
        request.setSysAction("SendSms");
        request.putQueryParameter("RegionId", "cn-hangzhou");
        request.putQueryParameter("PhoneNumbers", "17852360582");
        request.putQueryParameter("SignName", "rabbitmq短信服务");
        request.putQueryParameter("TemplateCode", "SMS_205439514");
        //这个里面填写验证码内容
        request.putQueryParameter("TemplateParam", "{\"code\":\"1234\"}");
        try {
            CommonResponse response = client.getCommonResponse(request);
            System.out.println(response.getData());
        } catch (ClientException e) {
            e.printStackTrace();
        }
    }
}